$dir = "/data1/bsi/BORA_processing/devel/eqtl/genotype_survival_bootstrap";
open BUFF,"input_withcorrecthead.tped" or die "no input file\n";
open WRBUFF,">fileinputdirec";
$header = <BUFF>;
$n =1000;
$k =0;
$m =1;
$buff = "BUFF$m";
system("mkdir $m");
print WRBUFF "$dir/$m\n"; 
open($buff,">./$m/temp_input");
print $buff $header;
while(<BUFF>)
{
	chomp($_);
	if($n == $k)
	{
		#die;
		$m++;
		close($buff);
		$buff = "BUFF$m";
		#die;	
		system("mkdir $m");
		print WRBUFF "$dir/$m\n";
		open($buff,">./$m/temp_input");
		print $buff $header;
		print "$m\n";
		$k = 0;
		
	}
	print $buff $_."\n";
	$k++;
}


